/*
 ------------------------------------------------------------------------------
 Copyright (C) 2006-2007 Team Blur.

 This file is part of the Quantum Engine source code.

 The Quantum Engine source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quantum Engine source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quantum Engine source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


#ifndef __FRAMEWORK_EDITOR_H__
#define __FRAMEWORK_EDITOR_H__


typedef enum {
	EDITOR_NONE,
	EDITOR_LIGHT,
	EDITOR_SOUND,
	EDITOR_EFFECT,
	EDITOR_REVERB
} editor_t;

// Light editor structures
typedef struct {
	odVec3					origin;
	odVec3					center;
	odAngles				angles;

	odVec3					radius;

	float					fovX;
	float					fovY;

	float					falloffRange;

	bool					projected;
	bool					parallel;
	bool					noShadows;

	int						detailLevel;

	char					material[MAX_OSPATH];
	float					materialParms[MAX_MATERIAL_PARMS];
} lightProperties_t;

typedef struct {
	void					(*Update)(int index, lightProperties_t *properties);
	void					(*Remove)(int index);
	void					(*Clear)(void);
	void					(*Save)(void);
	void					(*Close)(void);
} lightCallbacks_t;

// Reverb editor structures
typedef struct {
	float					density;
	float					diffusion;

	float					gain;
	float					gainHF;
	float					gainLF;

	float					decayTime;
	float					decayHFRatio;
	float					decayLFRatio;
	bool					decayHFLimit;

	float					reflectionsGain;
	float					reflectionsDelay;
	odVec3					reflectionsPan;

	float					lateReverbGain;
	float					lateReverbDelay;
	odVec3					lateReverbPan;

	float					echoTime;
	float					echoDepth;

	float					modulationTime;
	float					modulationDepth;

	float					hfReference;
	float					lfReference;

	float					airAbsorptionGainHF;
	float					roomRolloffFactor;
} reverbProperties_t;

typedef struct {
	void					(*Update)(int index, reverbProperties_t *properties);
	void					(*Clear)(void);
	void					(*Save)(void);
	void					(*Close)(void);
} reverbCallbacks_t;

/*
 ==============================================================================

 FUNCTIONS EXPORTED BY THE ENGINE

 ==============================================================================
*/

typedef struct {
	// Launches an integrated editor.
	// Note that only one editor can be active at a time.
	bool					(*LaunchEditor)(editor_t editor, bool (*mouseEvent)(void), void (*refresh)(void));

	// Closes the currently active integrated editor
	void					(*CloseEditor)(void);

	// Draws a box representing an editable entity
	void					(*DrawEditBox)(const odVec3 &color, const odVec3 corners[8]);

	// Light editor functions
	void					(*SetLightCallbacks)(lightCallbacks_t *callbacks);
	void					(*EditLightProperties)(int index, lightProperties_t *properties);

	// Reverb editor functions
	void					(*SetReverbCallbacks)(reverbCallbacks_t *callbacks);
	void					(*EditReverbProperties)(int index, reverbProperties_t *properties);
} odEditor_t;


#endif	// __FRAMEWORK_EDITOR_H__
